package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbBrandMapper;
import com.dongdongshop.pojo.TbBrand;
import com.dongdongshop.service.BrandService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@DubboService
public class BrandServiceImpl implements BrandService {

    @Resource
    private TbBrandMapper brandMapper;

    @Override
    public List<TbBrand> listPage() {
        return brandMapper.selectByExample(null);
    }

    @Override
    public int add(TbBrand brand) {
        return brandMapper.insertSelective(brand);
    }

    @Override
    public int update(TbBrand brand) {
        return brandMapper.updateByPrimaryKeySelective(brand);
    }

    @Override
    public TbBrand toUpdate(Long id) {
        return brandMapper.selectByPrimaryKey(id);
    }

    @Override
    public int deleteId(Long id) {
        return brandMapper.deleteByPrimaryKey(id);
    }
}
